//
//  CarTableCell.m
//  DingDongXiChe
//
//  Created by wtjr on 2018/1/11.
//  Copyright © 2018年 xieyingze. All rights reserved.
//

#import "CarTableCell.h"

@interface CarTableCell()

@property (nonatomic, strong) UIView *mainView;

@property (nonatomic, strong) BaseLabel *carNameLabel;

@end

@implementation CarTableCell

+ (instancetype)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    static NSString *cellId = @"CarTableCell";
    CarTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[CarTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    return cell;
}

#pragma mark - init

- (void)initSubView {
    [self addSubview:self.mainView];
}

- (void)autoLayoutSubviews {
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];
}

#pragma mark - Method


#pragma mark - Interface


#pragma mark - Setter

- (void)setModel:(CardModel *)model {
    self.carNameLabel.text = model.name;
}

#pragma mark - Getter

- (UIView *)mainView {
    if (!_mainView) {
        _mainView = [UIView new];
        _mainView.backgroundColor = kCOLOR_white;
        
        BaseLabel *carNameLabel = [BaseLabel new];
        [carNameLabel setLabelStyle:@"奥迪A6" textColor:KCOLOR_font_light textFont:kFONT_normal texrAlignment:NSTextAlignmentLeft];
        self.carNameLabel = carNameLabel;
        [_mainView addSubview:carNameLabel];
        [carNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@55);
            make.centerY.equalTo(@0);
            make.height.equalTo(@20);
        }];
    }
    return _mainView;
}


@end
